<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>引用数据类型</title>
    <script>
        function displayInfo(args) {
            let output = "";

            //通过typeof 判断属性是否存在
            if (typeof args.name == "string") {
                output += "name: " + args.name + "; \n";
            }
            if (typeof args.age == "number") {
                output += "age: " + args.age + "; \n";
            }
            alert(output);
        }

        displayInfo({
            name: "zhangsan",
            age: 25
        });

        displayInfo({
            name: "lisi"
        });


        let person = {
            name: "李四",
            "detail address":"山东 菏泽"
        }
        alert("person name : " + person.name)
        alert("person name2 : " + person["name"])

        alert("detail address: " + person["detail address"]);//这个变量就无法使用点语法来表示

    </script>
</head>
<body>
对象
</body>
</html>